//订单确认页面
var basePage = require('../../../common/BasePage');
Page({
    behaviors: [basePage],
    data: {
        
		wuliu:[],
		selectIndex:0
    },
    onLoad: function (option) {
		console.log("option",option)
		let that = this;
		const eventChannel = this.getOpenerEventChannel();
		eventChannel.on('specialList', function (data) {
		    
		    that.setData({
		        
				wuliu:data.specialList
		    })
		
		})
    },
    
	
	
	/* 选择物流 */
	clickwuliu(e){
		var index=e.currentTarget.dataset.index
		var list=this.data.wuliu
		list[index].select=!list[index].select
		this.setData({
			selectIndex:e.currentTarget.dataset.index,
			wuliu:list
		})
	},
	clickShipping: function (e) { 
	  console.log('clickShipping', e);
	  
	  var list=this.data.wuliu
	  var arr=[]
	  list.map(val=>{
		  if(val.select){
			  arr.push(val)
		  }
	  })
	  var that=this
	  const eventChannel = this.getOpenerEventChannel();
	  eventChannel.emit('change_special', {
	    selectList: arr,
		specialList:that.data.wuliu
	  });
	  wx.navigateBack({
	    delta: 1,
	  })
	},
})